import { Component, OnInit, Inject } from '@angular/core';
import { TodoService } from '../todo/services/todo.service';
@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
  username = "";
  password = "";
  constructor( @Inject('todoService') private _service: TodoService) {

  }

  ngOnInit() {
  }

  login(form1: any) {
    this._service.login(this.username, this.password)
      .subscribe(value=>{
        if(value)
        {
          console.log(document.cookie);
        }
      });
  }
  logout(){
    this._service.logout()
      .subscribe(value=>{
        console.log(value);
      });
  }
}
